#pragma once

#include <cftc/reflect/object.h>
#include <cftf/meta/table.h>

namespace mt
{

    class PlayerCreateInfoItem;
    class PlayerCreateInfoAction;
    class PlayerCreateInfoSpell;
    class PlayerLevelStats;
    class PlayerCreateInfo : public cftc::reflect::Object, public cftf::meta::Table<PlayerCreateInfo, unsigned int>
    {
        CFT_DECLARE_REFLECT_CLASS();    
    public:
        struct PlayerClassLevelInfo
        {
            PlayerClassLevelInfo() : basehealth(0), basemana(0) {}
            unsigned short basehealth = 0;
            unsigned short basemana = 0;
        };
        struct PlayerLevelInfo
        {
            unsigned char stats[MAX_STATS] = {0};
        };
    public:
        unsigned int mapId = 0;
        unsigned int areaId = 0;
        float positionX = 0;
        float positionY = 0;
        float positionZ = 0;
        float orientation = 0;
        unsigned short displayId_m = 0;
        unsigned short displayId_f = 0;
        std::list<const PlayerCreateInfoItem*> item;
        std::list<const PlayerCreateInfoSpell*> spell;
        std::list<const PlayerCreateInfoAction*> action;

        unsigned int race = 0;
        unsigned int _class = 0;
        //PlayerLevelInfo* levelInfo = nullptr; //[level-1] 0..MaxPlayerLevel-1
        std::vector<const PlayerLevelStats*> levelInfo;

        static void GetPlayerClassLevelInfo(unsigned int race, unsigned int _class, PlayerClassLevelInfo* class_info);
        static void GetPlayerLevelInfo(unsigned int race, unsigned int _class, unsigned int level, PlayerLevelInfo* info);

        void MetaInstanceInit1();
        static const PlayerCreateInfo* GetByRaceClass(unsigned int race, unsigned int _class);
    private:
        inline static std::map<long long, const PlayerCreateInfo*> race_class_hash_;
    };

}